package org.jeecg.modules.online.cgform.utils;

import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONException;
import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.IdWorker;
import java.io.BufferedWriter;
import java.io.File;
import java.io.FileWriter;
import java.io.IOException;
import java.io.Reader;
import java.io.UnsupportedEncodingException;
import java.net.URLDecoder;
import java.sql.Blob;
import java.sql.Clob;
import java.sql.SQLException;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collection;
import java.util.Collections;
import java.util.Comparator;
import java.util.Date;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import java.util.Objects;
import java.util.Set;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
import java.util.stream.Collectors;
import javax.servlet.http.HttpServletRequest;
import org.apache.shiro.SecurityUtils;
import org.jeecg.common.exception.TuringBootException;
import org.jeecg.common.system.api.ISysBaseAPI;
import org.jeecg.common.system.query.MatchTypeEnum;
import org.jeecg.common.system.query.QueryGenerator;
import org.jeecg.common.system.query.QueryRuleEnum;
import org.jeecg.common.system.util.JwtUtil;
import org.jeecg.common.system.vo.DictModel;
import org.jeecg.common.system.vo.LoginUser;
import org.jeecg.common.system.vo.SysUserCacheInfo;
import org.jeecg.common.util.CommonUtils;
import org.jeecg.common.util.DateUtils;
import org.jeecg.common.util.Md5Util;
import org.jeecg.common.util.SpringContextUtils;
import org.jeecg.common.util.SqlInjectionUtil;
import org.jeecg.common.util.UUIDGenerator;
import org.jeecg.common.util.oConvertUtils;
import org.jeecg.common.util.p000a.BaseColumn;
import org.jeecg.common.util.p000a.CommonProperty;
import org.jeecg.common.util.p000a.JsonSchemaDescrip;
import org.jeecg.common.util.p000a.JsonschemaUtil;
import org.jeecg.common.util.p000a.p001a.DictProperty;
import org.jeecg.common.util.p000a.p001a.HiddenProperty;
import org.jeecg.common.util.p000a.p001a.LinkDownProperty;
import org.jeecg.common.util.p000a.p001a.NumberProperty;
import org.jeecg.common.util.p000a.p001a.PopupDictProperty;
import org.jeecg.common.util.p000a.p001a.PopupProperty;
import org.jeecg.common.util.p000a.p001a.StringProperty;
import org.jeecg.common.util.p000a.p001a.SwitchProperty;
import org.jeecg.common.util.p000a.p001a.TreeSelectProperty;
import org.jeecg.config.mybatis.MybatisPlusSaasConfig;
import org.jeecg.modules.online.cgform.consts.ExtendJsonKey;
import org.jeecg.modules.online.cgform.consts.OnlineConst;
import org.jeecg.modules.online.cgform.entity.OnlCgformButton;
import org.jeecg.modules.online.cgform.entity.OnlCgformEnhanceJava;
import org.jeecg.modules.online.cgform.entity.OnlCgformEnhanceJs;
import org.jeecg.modules.online.cgform.entity.OnlCgformField;
import org.jeecg.modules.online.cgform.entity.OnlCgformHead;
import org.jeecg.modules.online.cgform.entity.OnlCgformIndex;
import org.jeecg.modules.online.cgform.enums.CgformConstant;
import org.jeecg.modules.online.cgform.enums.CgformValidPatternEnum;
import org.jeecg.modules.online.cgform.mapper.OnlCgformHeadMapper;
import org.jeecg.modules.online.cgform.model.TreeSelectColumn;
import org.jeecg.modules.online.config.exception.DBException;
import org.jeecg.modules.online.config.p020b.OnlineFieldConfig;
import org.jeecg.modules.online.config.p022d.DataBaseConst;
import org.jeecg.modules.online.config.p022d.DbTableUtil;
import org.jeecgframework.poi.excel.entity.params.ExcelExportEntity;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

/* renamed from: org.jeecg.modules.online.cgform.d.c */
/* loaded from: hibernate-re-3.7.1-RC.jar:org/jeecg/modules/online/cgform/d/c.class */
public class CgformUtil {

    /* renamed from: a */
    public static final String SELECT = "SELECT ";

    /* renamed from: b */
    public static final String f204b = " FROM ";

    /* renamed from: c */
    public static final String f205c = " JOIN ";

    /* renamed from: d */
    public static final String f206d = " ON ";

    /* renamed from: e */
    public static final String f207e = " AND ";

    /* renamed from: f */
    public static final String f208f = " like ";

    /* renamed from: g */
    public static final String f209g = " COUNT(*) ";

    /* renamed from: h */
    public static final String f210h = " where 1=1  ";

    /* renamed from: i */
    public static final String f211i = " where  ";

    /* renamed from: j */
    public static final String f212j = " ORDER BY ";

    /* renamed from: k */
    public static final String f213k = "asc";

    /* renamed from: l */
    public static final String f214l = "desc";

    /* renamed from: m */
    public static final String f215m = "=";

    /* renamed from: n */
    public static final String f216n = "!=";

    /* renamed from: o */
    public static final String f217o = ">=";

    /* renamed from: p */
    public static final String f218p = ">";

    /* renamed from: q */
    public static final String f219q = "<=";

    /* renamed from: r */
    public static final String f220r = "<";

    /* renamed from: s */
    public static final String f221s = " or ";

    /* renamed from: t */
    public static final String f222t = "jeecg_row_key";

    /* renamed from: u */
    public static final String f223u = "Y";

    /* renamed from: v */
    public static final String f224v = "$";

    /* renamed from: w */
    public static final String f225w = "CREATE_TIME";

    /* renamed from: x */
    public static final String f226x = "CREATE_BY";

    /* renamed from: y */
    public static final String f227y = "UPDATE_TIME";

    /* renamed from: z */
    public static final String f228z = "UPDATE_BY";

    /* renamed from: A */
    public static final String f229A = "SYS_ORG_CODE";

    /* renamed from: B */
    public static final int f230B = 2;

    /* renamed from: C */
    public static final String f231C = "'";

    /* renamed from: D */
    public static final String f232D = "N";

    /* renamed from: E */
    public static final String f233E = ",";

    /* renamed from: F */
    public static final String f234F = "single";

    /* renamed from: G */
    public static final String f235G = "id";

    /* renamed from: H */
    public static final String f236H = "bpm_status";

    /* renamed from: I */
    public static final String f237I = "1";

    /* renamed from: J */
    public static final String f238J = "force";

    /* renamed from: K */
    public static final String f239K = "normal";

    /* renamed from: L */
    public static final String f240L = "switch";

    /* renamed from: M */
    public static final String f241M = "popup";

    /* renamed from: N */
    public static final String f242N = "popup_dict";

    /* renamed from: O */
    public static final String f243O = "sel_search";

    /* renamed from: P */
    public static final String f244P = "image";

    /* renamed from: Q */
    public static final String f245Q = "file";

    /* renamed from: R */
    public static final String f246R = "sel_tree";

    /* renamed from: S */
    public static final String f247S = "cat_tree";

    /* renamed from: T */
    public static final String f248T = "link_down";

    /* renamed from: U */
    public static final String f249U = "date";

    /* renamed from: V */
    public static final String f250V = "SYS_USER";

    /* renamed from: W */
    public static final String f251W = "REALNAME";

    /* renamed from: X */
    public static final String f252X = "USERNAME";

    /* renamed from: Y */
    public static final String f253Y = "SYS_DEPART";

    /* renamed from: Z */
    public static final String f254Z = "DEPART_NAME";

    /* renamed from: aa */
    public static final String f255aa = "ID";

    /* renamed from: ab */
    public static final String f256ab = "SYS_CATEGORY";

    /* renamed from: ac */
    public static final String f257ac = "NAME";

    /* renamed from: ad */
    public static final String f258ad = "CODE";

    /* renamed from: ae */
    public static final String f259ae = "ID";

    /* renamed from: af */
    public static final String f260af = "PID";

    /* renamed from: ag */
    public static final String f261ag = "HAS_CHILD";

    /* renamed from: ah */
    public static final String f262ah = "sel_search";

    /* renamed from: ai */
    public static final String f263ai = "link_table";

    /* renamed from: aj */
    public static final String f264aj = "link_table_field";

    /* renamed from: ak */
    public static final String f265ak = "sub_table_design_";

    /* renamed from: al */
    public static final String f266al = "sub-table-design_";

    /* renamed from: am */
    public static final String f267am = "sub-table-one2one_";

    /* renamed from: an */
    public static final String f268an = "import";

    /* renamed from: ao */
    public static final String f269ao = "export";

    /* renamed from: ap */
    public static final String f270ap = "query";

    /* renamed from: aq */
    public static final String f271aq = "form";

    /* renamed from: ar */
    public static final String f272ar = "list";

    /* renamed from: as */
    public static final String f273as = "1";

    /* renamed from: at */
    public static final String f274at = "start";

    /* renamed from: au */
    public static final String f275au = "erp";

    /* renamed from: av */
    public static final String f276av = "innerTable";

    /* renamed from: aw */
    public static final String f277aw = "exportSingleOnly";

    /* renamed from: ax */
    public static final String f278ax = "isSingleTableImport";

    /* renamed from: ay */
    public static final String f279ay = "validateStatus";

    /* renamed from: az */
    public static final String f280az = "1";

    /* renamed from: aA */
    public static final String f281aA = "foreignKeys";

    /* renamed from: aB */
    public static final int f282aB = 1;

    /* renamed from: aC */
    public static final int f283aC = 2;

    /* renamed from: aD */
    public static final int f284aD = 0;

    /* renamed from: aE */
    public static final int f285aE = 1;

    /* renamed from: aF */
    public static final int f286aF = 1;

    /* renamed from: aG */
    public static final String f287aG = "1";

    /* renamed from: aI */
    public static final String f289aI = "1";

    /* renamed from: aJ */
    public static final String f290aJ = "id";

    /* renamed from: aK */
    public static final String f291aK = "center";

    /* renamed from: aL */
    public static final String f292aL = "modules/bpm/task/form/OnlineFormDetail";

    /* renamed from: aM */
    public static final String f293aM = "check/onlineForm/detail";

    /* renamed from: aN */
    public static final String f294aN = "onl_";

    /* renamed from: aO */
    public static final String f295aO = "jeecg_submit_form_and_flow";

    /* renamed from: aP */
    public static final String joinQuery = "joinQuery";

    /* renamed from: aQ */
    public static final String properties = "properties";

    /* renamed from: aR */
    public static final String f298aR = "title";

    /* renamed from: aS */
    public static final String view = "view";

    /* renamed from: aT */
    public static final String f300aT = "table";

    /* renamed from: aU */
    public static final String f301aU = "searchFieldList";

    /* renamed from: aV */
    public static final String f302aV = "switchOptions";

    /* renamed from: aW */
    public static final String f303aW = "extConfigJson";

    /* renamed from: aX */
    public static final String f304aX = "0";

    /* renamed from: aY */
    public static final String f305aY = "1";

    /* renamed from: ba */
    private static final String f306ba = "beforeAdd,beforeEdit,afterAdd,afterEdit,beforeDelete,afterDelete,mounted,created";

    /* renamed from: bb */
    private static String f307bb;

    /* renamed from: aZ */
    private static final Logger f202aZ = LoggerFactory.getLogger(CgformUtil.class);

    /* renamed from: aH */
    public static final Integer f288aH = 2;

    /* renamed from: a */
    public static boolean m349a(OnlCgformHead onlCgformHead) {
        String extConfigJson;
        if (onlCgformHead != null && f288aH.equals(onlCgformHead.getTableType())) {
            String themeTemplate = onlCgformHead.getThemeTemplate();
            if (!f275au.equals(themeTemplate) && !f276av.equals(themeTemplate) && !"Y".equals(onlCgformHead.getIsTree()) && (extConfigJson = onlCgformHead.getExtConfigJson()) != null && !"".equals(extConfigJson)) {
                JSONObject parseObject = JSON.parseObject(extConfigJson);
                if (parseObject.containsKey(joinQuery) && 1 == parseObject.getInteger(joinQuery).intValue()) {
                    return true;
                }
                return false;
            }
            return false;
        }
        return false;
    }

    /* renamed from: a */
    public static void m371a(String str, List<OnlCgformField> list, StringBuffer stringBuffer) {
        if (list == null || list.size() == 0) {
            stringBuffer.append("SELECT id");
        } else {
            stringBuffer.append(SELECT);
            int size = list.size();
            boolean z = false;
            for (int i = 0; i < size; i++) {
                OnlCgformField onlCgformField = list.get(i);
                onlCgformField.setDbFieldName(SqlInjectionUtil.getSqlInjectField(onlCgformField.getDbFieldName()));
                if (OnlineConst.f140b.equals(onlCgformField.getDbIsPersist())) {
                    if ("id".equals(onlCgformField.getDbFieldName())) {
                        z = true;
                    }
                    if (f247S.equals(onlCgformField.getFieldShowType()) && oConvertUtils.isNotEmpty(onlCgformField.getDictText())) {
                        stringBuffer.append(onlCgformField.getDictText() + f233E);
                    }
                    if (i == size - 1) {
                        stringBuffer.append(onlCgformField.getDbFieldName() + " ");
                    } else {
                        stringBuffer.append(onlCgformField.getDbFieldName() + f233E);
                    }
                }
            }
            if (f233E.equals(stringBuffer.substring(stringBuffer.length() - 1))) {
                stringBuffer.deleteCharAt(stringBuffer.length() - 1);
            }
            if (!z) {
                stringBuffer.append(",id");
            }
        }
        stringBuffer.append(f204b + m317f(str));
    }

    /* renamed from: a */
    public static String m378a(String str) {
        return " to_date('" + str + "','yyyy-MM-dd HH24:mi:ss')";
    }

    /* renamed from: b */
    public static String m344b(String str) {
        return " to_date('" + str + "','yyyy-MM-dd')";
    }

    /* renamed from: c */
    public static boolean m332c(String str) {
        if (f272ar.equals(str) || "radio".equals(str) || "checkbox".equals(str) || "list_multi".equals(str)) {
            return true;
        }
        return false;
    }

    /* renamed from: a */
    public static boolean m352a(OnlCgformField onlCgformField) {
        if (oConvertUtils.isNotEmpty(onlCgformField.getMainField()) && oConvertUtils.isNotEmpty(onlCgformField.getMainTable())) {
            String fieldExtendJson = onlCgformField.getFieldExtendJson();
            if (oConvertUtils.isNotEmpty(fieldExtendJson) && fieldExtendJson.indexOf(ExtendJsonKey.f137j) > 0) {
                onlCgformField.setDictTable(onlCgformField.getMainTable());
                onlCgformField.setDictField(onlCgformField.getMainField());
                onlCgformField.setFieldShowType("sel_search");
                onlCgformField.setDictText(JSON.parseObject(fieldExtendJson).getString(ExtendJsonKey.f137j));
                return true;
            }
            return false;
        }
        return false;
    }

    /* renamed from: a */
    public static void m369a(StringBuilder sb, String str, JSONObject jSONObject, MatchTypeEnum matchTypeEnum, JSONObject jSONObject2, boolean z) {
        if (!z) {
            sb.append(" ").append(matchTypeEnum.getValue()).append(" ");
        }
        String string = jSONObject.getString("type");
        String string2 = jSONObject.getString("val");
        String m279a = SuperQueryLoaderTools.m279a(string, string2);
        QueryRuleEnum byValue = QueryRuleEnum.getByValue(jSONObject.getString("rule"));
        if (byValue == null) {
            byValue = QueryRuleEnum.EQ;
        }
        if (jSONObject2 != null) {
            String string3 = jSONObject2.getString("subTableName");
            String string4 = jSONObject2.getString("subField");
            jSONObject2.getString("mainTable");
            sb.append("(").append(jSONObject2.getString("mainField")).append(" IN (SELECT ").append(string4).append(f204b).append(string3).append(" WHERE ");
            if (f241M.equals(string)) {
                sb.append(m343b(str, string2));
            } else {
                sb.append(str);
                SuperQueryLoaderTools.m275a(sb, byValue, string2, m279a, string);
            }
            sb.append("))");
        } else if (f241M.equals(string)) {
            sb.append(m343b(str, string2));
        } else {
            sb.append(str);
            SuperQueryLoaderTools.m275a(sb, byValue, string2, m279a, string);
        }
    }

    /* renamed from: a */
    public static Map<String, Object> m358a(HttpServletRequest httpServletRequest) {
        String str;
        //String[] strArr;
        Map<String,String[]> parameterMap = httpServletRequest.getParameterMap();
        Map hashMap = new HashMap(5);
        String str2 = "";
        for (Map.Entry entry : parameterMap.entrySet()) {
            String str3 = (String) entry.getKey();
            Object value = entry.getValue();
            if ("_t".equals(str3) || null == value) {
                str = "";
            } else if (value instanceof String[]) {
                for (int i = 0; i < ((String[]) value).length; i++) {
                    //str2 = strArr[i] + f233E;
                    str2 =  f233E;
                }
                str = str2.substring(0, str2.length() - 1);
            } else {
                str = value.toString();
            }
            str2 = str;
            hashMap.put(str3, str2);
        }
        return hashMap;
    }

    /* renamed from: a */
    public static boolean m373a(String str, List<OnlCgformField> list) {
        for (OnlCgformField onlCgformField : list) {
            if (str.equals(onlCgformField.getDbFieldName())) {
                return true;
            }
        }
        return false;
    }

    /* JADX WARN: Multi-variable type inference failed */
    /* JADX WARN: Type inference failed for: r0v115, types: [org.jeecg.common.util.a.a.i] */
    /* JADX WARN: Type inference failed for: r0v120, types: [org.jeecg.common.util.a.a.c] */
    /* JADX WARN: Type inference failed for: r0v123, types: [org.jeecg.common.util.a.a.e] */
    /* JADX WARN: Type inference failed for: r0v135, types: [org.jeecg.common.util.a.a.f] */
    /* JADX WARN: Type inference failed for: r0v167, types: [org.jeecg.common.util.a.a.d] */
    /* JADX WARN: Type inference failed for: r0v211, types: [org.jeecg.common.util.a.a.h] */
    /* JADX WARN: Type inference failed for: r0v71, types: [org.jeecg.common.util.a.a.g] */
    /* JADX WARN: Type inference failed for: r0v82, types: [org.jeecg.common.util.a.a.i] */
    /* JADX WARN: Type inference failed for: r0v95, types: [org.jeecg.common.util.a.a.i] */
    /* JADX WARN: Type inference failed for: r0v99, types: [org.jeecg.common.util.a.a.i] */
    /* renamed from: a */
    public static JSONObject m362a(List<OnlCgformField> list, List<String> list2, TreeSelectColumn treeSelectColumn) {
        JSONObject m584a;
        CommonProperty dictProperty;
        String[] split;
        new JSONObject();
        List arrayList = new ArrayList();
        List arrayList2 = new ArrayList();
        ISysBaseAPI iSysBaseAPI = (ISysBaseAPI) SpringContextUtils.getBean(ISysBaseAPI.class);
        OnlCgformHeadMapper onlCgformHeadMapper = (OnlCgformHeadMapper) SpringContextUtils.getBean(OnlCgformHeadMapper.class);
        ArrayList arrayList3 = new ArrayList();
        for (OnlCgformField onlCgformField : list) {
            String dbFieldName = onlCgformField.getDbFieldName();
            if (!"id".equals(dbFieldName) && !arrayList3.contains(dbFieldName)) {
                String dbFieldTxt = onlCgformField.getDbFieldTxt();
                if ("1".equals(onlCgformField.getFieldMustInput())) {
                    arrayList.add(dbFieldName);
                }
                String fieldShowType = onlCgformField.getFieldShowType();
                if (f240L.equals(fieldShowType)) {
                    dictProperty = new SwitchProperty(dbFieldName, dbFieldTxt, onlCgformField.getFieldExtendJson());
                } else if (m332c(fieldShowType) || f264aj.equals(fieldShowType)) {
                    dictProperty = new DictProperty(dbFieldName, fieldShowType, dbFieldTxt, onlCgformField.getDictTable(), onlCgformField.getDictField(), onlCgformField.getDictText());
                    if (OnlineDbHandler.m286a(onlCgformField.getDbType())) {
                        dictProperty.setType(DataBaseConst.f577h);
                    }
                } else if ("sel_search".equals(fieldShowType) || m352a(onlCgformField)) {
                    dictProperty = new DictProperty(dbFieldName, dbFieldTxt, onlCgformField.getDictTable(), onlCgformField.getDictField(), onlCgformField.getDictText());
                } else if (f263ai.equals(fieldShowType)) {
                    dictProperty = new DictProperty(dbFieldName, dbFieldTxt, onlCgformField.getDictTable(), onlCgformField.getDictField(), onlCgformField.getDictText());
                    dictProperty.setView(f263ai);
                } else if (OnlineDbHandler.m286a(onlCgformField.getDbType())) {
                	NumberProperty numberProperty = new NumberProperty(dbFieldName, dbFieldTxt, DataBaseConst.f577h);
                    if (CgformValidPatternEnum.INTEGER.getType().equals(onlCgformField.getFieldValidType())) {
                        numberProperty.setPattern(CgformValidPatternEnum.INTEGER.getPattern());
                    }
                    dictProperty = numberProperty;
                } else if (f241M.equals(fieldShowType)) {
                	PopupProperty popupProperty = new PopupProperty(dbFieldName, dbFieldTxt, onlCgformField.getDictTable(), onlCgformField.getDictText(), onlCgformField.getDictField());
                    String dictText = onlCgformField.getDictText();
                    if (dictText != null && !"".equals(dictText)) {
                        for (String str : dictText.split(f233E)) {
                            if (!m373a(str, list)) {
                                HiddenProperty hiddenProperty = new HiddenProperty(str, str);
                                hiddenProperty.setOrder(onlCgformField.getOrderNum());
                                arrayList2.add(hiddenProperty);
                            }
                        }
                    }
                    String fieldExtendJson = onlCgformField.getFieldExtendJson();
                    if (fieldExtendJson != null && !"".equals(fieldExtendJson)) {
                        JSONObject parseObject = JSONObject.parseObject(fieldExtendJson);
                        if (parseObject.containsKey(ExtendJsonKey.f130c)) {
                            popupProperty.setPopupMulti(parseObject.getBoolean(ExtendJsonKey.f130c));
                        }
                    }
                    dictProperty = popupProperty;
                } else if (f242N.equals(fieldShowType)) {
                	PopupDictProperty popupDictProperty = new PopupDictProperty(dbFieldName, dbFieldTxt, onlCgformField.getDictTable(), onlCgformField.getDictText(), onlCgformField.getDictField());
                    String fieldExtendJson2 = onlCgformField.getFieldExtendJson();
                    if (fieldExtendJson2 != null && !"".equals(fieldExtendJson2)) {
                        JSONObject parseObject2 = JSONObject.parseObject(fieldExtendJson2);
                        if (parseObject2.containsKey(ExtendJsonKey.f130c)) {
                            popupDictProperty.setPopupMulti(parseObject2.getBoolean(ExtendJsonKey.f130c));
                        }
                    }
                    dictProperty = popupDictProperty;
                } else if (f248T.equals(fieldShowType)) {
                	LinkDownProperty linkDownProperty = new LinkDownProperty(dbFieldName, dbFieldTxt, onlCgformField.getDictTable());
                    m357a((LinkDownProperty) linkDownProperty, list, arrayList3, arrayList);
                    dictProperty = linkDownProperty;
                } else if (f246R.equals(fieldShowType)) {
                    String[] split2 = onlCgformField.getDictText().split(f233E);
                    TreeSelectProperty treeSelectProperty = new TreeSelectProperty(dbFieldName, dbFieldTxt, onlCgformField.getDictTable() + f233E + split2[2] + f233E + split2[0], split2[1], onlCgformField.getDictField());
                    if (split2.length > 3) {
                        treeSelectProperty.setHasChildField(split2[3]);
                    }
                    dictProperty = treeSelectProperty;
                } else if (f247S.equals(fieldShowType)) {
                    String dictText2 = onlCgformField.getDictText();
                    String dictField = onlCgformField.getDictField();
                    String str2 = f304aX;
                    if (oConvertUtils.isNotEmpty(dictField) && !f304aX.equals(dictField)) {
                        str2 = onlCgformHeadMapper.queryCategoryIdByCode(dictField);
                    }
                    if (oConvertUtils.isEmpty(dictText2)) {
                        dictProperty = new TreeSelectProperty(dbFieldName, dbFieldTxt, str2);
                    } else {
                        dictProperty = new TreeSelectProperty(dbFieldName, dbFieldTxt, str2, dictText2);
                        arrayList2.add(new HiddenProperty(dictText2, dictText2));
                    }
                } else if (treeSelectColumn != null && dbFieldName.equals(treeSelectColumn.getFieldName())) {
                	TreeSelectProperty treeSelectProperty2 = new TreeSelectProperty(dbFieldName, dbFieldTxt, treeSelectColumn.getTableName() + f233E + treeSelectColumn.getTextField() + f233E + treeSelectColumn.getCodeField(), treeSelectColumn.getPidField(), treeSelectColumn.getPidValue());
                    treeSelectProperty2.setHasChildField(treeSelectColumn.getHsaChildField());
                    treeSelectProperty2.setPidComponent(1);
                    dictProperty = treeSelectProperty2;
                } else {
                    dictProperty = new StringProperty(dbFieldName, dbFieldTxt, fieldShowType, onlCgformField.getDbLength());
                }
                if (oConvertUtils.isNotEmpty(onlCgformField.getFieldValidType())) {
                    CgformValidPatternEnum patternInfoByType = CgformValidPatternEnum.getPatternInfoByType(onlCgformField.getFieldValidType());
                    String m376a = m376a(ExtendJsonKey.f136i, onlCgformField.getFieldExtendJson());
                    if (patternInfoByType != null) {
                        if (CgformValidPatternEnum.NOTNULL == patternInfoByType) {
                            arrayList.add(dbFieldName);
                        } else {
                            dictProperty.setPattern(patternInfoByType.getPattern());
                            if (oConvertUtils.isEmpty(m376a)) {
                                dictProperty.setErrorInfo(patternInfoByType.getMsg());
                            } else {
                                dictProperty.setErrorInfo(m376a);
                            }
                        }
                    } else {
                        dictProperty.setPattern(onlCgformField.getFieldValidType());
                        if (oConvertUtils.isEmpty(m376a)) {
                            dictProperty.setErrorInfo("输入的值不合法");
                        } else {
                            dictProperty.setErrorInfo(m376a);
                        }
                    }
                }
                if (onlCgformField.getIsReadOnly().intValue() == 1 || (list2 != null && list2.indexOf(dbFieldName) >= 0)) {
                    dictProperty.setDisabled(true);
                }
                dictProperty.setOrder(onlCgformField.getOrderNum());
                dictProperty.setDefVal(onlCgformField.getFieldDefaultValue());
                dictProperty.setFieldExtendJson(onlCgformField.getFieldExtendJson());
                dictProperty.setDbPointLength(onlCgformField.getDbPointLength());
                dictProperty.setMode(onlCgformField.getQueryMode());
                arrayList2.add(dictProperty);
            }
        }
        if (arrayList.size() > 0) {
            m584a = JsonschemaUtil.m584a(new JsonSchemaDescrip(arrayList), arrayList2);
        } else {
            m584a = JsonschemaUtil.m584a(new JsonSchemaDescrip(), arrayList2);
        }
        return m584a;
    }

    /* renamed from: a */
    public static String m376a(String str, String str2) {
        String str3 = "";
        if (str2 != null && !"".equals(str2)) {
            JSONObject parseObject = JSONObject.parseObject(str2);
            if (parseObject.containsKey(str)) {
                str3 = parseObject.getString(str);
            }
        }
        return str3;
    }

    /* renamed from: b */
    public static JSONObject m342b(String str, List<OnlCgformField> list) {
        CommonProperty stringProperty;
        new JSONObject();
        ArrayList arrayList = new ArrayList();
        ArrayList arrayList2 = new ArrayList();
        ISysBaseAPI iSysBaseAPI = (ISysBaseAPI) SpringContextUtils.getBean(ISysBaseAPI.class);
        for (OnlCgformField onlCgformField : list) {
            String dbFieldName = onlCgformField.getDbFieldName();
            if (!"id".equals(dbFieldName)) {
                String dbFieldTxt = onlCgformField.getDbFieldTxt();
                if ("1".equals(onlCgformField.getFieldMustInput())) {
                    arrayList.add(dbFieldName);
                }
                String fieldShowType = onlCgformField.getFieldShowType();
                String dictField = onlCgformField.getDictField();
                if (OnlineDbHandler.m286a(onlCgformField.getDbType())) {
                    stringProperty = new NumberProperty(dbFieldName, dbFieldTxt, DataBaseConst.f577h);
                } else if (m332c(fieldShowType)) {
                    stringProperty = new StringProperty(dbFieldName, dbFieldTxt, fieldShowType, onlCgformField.getDbLength(), iSysBaseAPI.queryDictItemsByCode(dictField));
                } else {
                    stringProperty = new StringProperty(dbFieldName, dbFieldTxt, fieldShowType, onlCgformField.getDbLength());
                }
                CommonProperty commonProperty = stringProperty;
                commonProperty.setOrder(onlCgformField.getOrderNum());
                arrayList2.add(commonProperty);
            }
        }
        return JsonschemaUtil.m585a(str, arrayList, arrayList2);
    }

    /* renamed from: a */
    public static Set<String> m367a(List<OnlCgformField> list) {
        String dictText;
        HashSet hashSet = new HashSet();
        for (OnlCgformField onlCgformField : list) {
            if (f241M.equals(onlCgformField.getFieldShowType()) && (dictText = onlCgformField.getDictText()) != null && !"".equals(dictText)) {
                hashSet.addAll((Collection) Arrays.stream(dictText.split(f233E)).collect(Collectors.toSet()));
            }
            if (f247S.equals(onlCgformField.getFieldShowType())) {
                String dictText2 = onlCgformField.getDictText();
                if (oConvertUtils.isNotEmpty(dictText2)) {
                    hashSet.add(dictText2);
                }
            }
        }
        for (OnlCgformField onlCgformField2 : list) {
            String dbFieldName = onlCgformField2.getDbFieldName();
            if (onlCgformField2.getIsShowForm().intValue() == 1 && hashSet.contains(dbFieldName)) {
                hashSet.remove(dbFieldName);
            }
        }
        return hashSet;
    }

    /* renamed from: a */
    public static Map<String, Object> m372a(String str, List<OnlCgformField> list, JSONObject jSONObject) {
        String dbFieldName;
        StringBuffer stringBuffer = new StringBuffer();
        StringBuffer stringBuffer2 = new StringBuffer();
        String str2 = "";
        try {
            str2 = DbTableUtil.getDatabaseType();
        } catch (SQLException e) {
            e.printStackTrace();
        } catch (DBException e2) {
            e2.printStackTrace();
        }
        HashMap hashMap = new HashMap(5);
        boolean z = false;
        String str3 = null;
        LoginUser loginUser = (LoginUser) SecurityUtils.getSubject().getPrincipal();
        if (loginUser == null) {
            throw new TuringBootException("online保存表单数据异常:系统未找到当前登陆用户信息");
        }
        Set<String> m367a = m367a(list);
        String m317f = m317f(str);
        boolean m310j = m310j(m317f);
        for (OnlCgformField onlCgformField : list) {
            if (OnlineConst.f140b.equals(onlCgformField.getDbIsPersist()) && null != (dbFieldName = onlCgformField.getDbFieldName())) {
                if ("id".equals(dbFieldName.toLowerCase())) {
                    z = true;
                    str3 = jSONObject.getString(dbFieldName);
                } else if (!m310j || !"tenant_id".equalsIgnoreCase(dbFieldName)) {
                    m351a(onlCgformField, loginUser, jSONObject, f226x, f225w, f229A);
                    if (f236H.equals(dbFieldName.toLowerCase())) {
                        stringBuffer.append(f233E + dbFieldName);
                        stringBuffer2.append(",'1'");
                    } else if (m367a.contains(dbFieldName)) {
                        stringBuffer.append(f233E + dbFieldName);
                        stringBuffer2.append(f233E + OnlineDbHandler.m285a(str2, onlCgformField, jSONObject, hashMap));
                    } else if (onlCgformField.getIsShowForm().intValue() == 1 || !oConvertUtils.isEmpty(onlCgformField.getMainField()) || !oConvertUtils.isEmpty(onlCgformField.getDbDefaultVal())) {
                        if (oConvertUtils.isEmpty(jSONObject.get(dbFieldName))) {
                            if (!oConvertUtils.isEmpty(onlCgformField.getDbDefaultVal())) {
                                jSONObject.put(dbFieldName, onlCgformField.getDbDefaultVal());
                            }
                        }
                        if ("".equals(jSONObject.get(dbFieldName))) {
                            String dbType = onlCgformField.getDbType();
                            if (!OnlineDbHandler.m286a(dbType) && !OnlineDbHandler.m283b(dbType)) {
                            }
                        }
                        stringBuffer.append(f233E + dbFieldName);
                        stringBuffer2.append(f233E + OnlineDbHandler.m285a(str2, onlCgformField, jSONObject, hashMap));
                    }
                }
            }
        }
        if (z) {
            if (oConvertUtils.isEmpty(str3)) {
                str3 = m385a();
            }
        } else {
            str3 = m385a();
        }
        if (m310j) {
            stringBuffer.append(f233E + "tenant_id");
            stringBuffer2.append(",#{tenant_id}");
            hashMap.put("tenant_id", SpringContextUtils.getHttpServletRequest().getHeader("X-Tenant-Id"));
        }
        hashMap.put("execute_sql_string", "insert into " + m317f + "(id" + stringBuffer.toString() + ") values(#{id,jdbcType=VARCHAR}" + stringBuffer2.toString() + ")");
        hashMap.put("id", str3);
        return hashMap;
    }

    /* renamed from: b */
    public static Map<String, Object> m341b(String str, List<OnlCgformField> list, JSONObject jSONObject) {
        String dbFieldName;
        StringBuffer stringBuffer = new StringBuffer();
        HashMap hashMap = new HashMap(5);
        String str2 = "";
        try {
            str2 = DbTableUtil.getDatabaseType();
        } catch (SQLException e) {
            e.printStackTrace();
        } catch (DBException e2) {
            e2.printStackTrace();
        }
        LoginUser loginUser = (LoginUser) SecurityUtils.getSubject().getPrincipal();
        if (loginUser == null) {
            throw new TuringBootException("online修改表单数据异常:系统未找到当前登陆用户信息");
        }
        Set<String> m367a = m367a(list);
        for (OnlCgformField onlCgformField : list) {
            if (OnlineConst.f140b.equals(onlCgformField.getDbIsPersist()) && null != (dbFieldName = onlCgformField.getDbFieldName())) {
                m351a(onlCgformField, loginUser, jSONObject, f228z, f227y);
                if (m367a.contains(dbFieldName) && jSONObject.get(dbFieldName) != null && !"".equals(jSONObject.getString(dbFieldName))) {
                    stringBuffer.append(dbFieldName + f215m + OnlineDbHandler.m285a(str2, onlCgformField, jSONObject, hashMap) + f233E);
                } else if (onlCgformField.getIsShowForm().intValue() == 1 && !"id".equals(dbFieldName)) {
                    if ("".equals(jSONObject.get(dbFieldName))) {
                        String dbType = onlCgformField.getDbType();
                        if (!OnlineDbHandler.m286a(dbType) && !OnlineDbHandler.m283b(dbType)) {
                        }
                    }
                    if (!oConvertUtils.isNotEmpty(onlCgformField.getMainTable()) || !oConvertUtils.isNotEmpty(onlCgformField.getMainField()) || !oConvertUtils.isEmpty(jSONObject.get(dbFieldName))) {
                        stringBuffer.append(dbFieldName + f215m + OnlineDbHandler.m285a(str2, onlCgformField, jSONObject, hashMap) + f233E);
                    }
                }
            }
        }
        String stringBuffer2 = stringBuffer.toString();
        if (stringBuffer2.endsWith(f233E)) {
            stringBuffer2 = stringBuffer2.substring(0, stringBuffer2.length() - 1);
        }
        hashMap.put("execute_sql_string", "update " + m317f(str) + " set " + stringBuffer2 + f211i + "id" + f215m + f231C + jSONObject.getString("id") + f231C);
        hashMap.put("id", jSONObject.getString("id"));
        return hashMap;
    }

    /* renamed from: a */
    public static QueryWrapper<?> m366a(List<OnlCgformField> list, String str) {
        return m365a(list, "id", str);
    }

    /* renamed from: a */
    public static QueryWrapper<?> m365a(List<OnlCgformField> list, String str, String str2) {
        String sqlInjectField = SqlInjectionUtil.getSqlInjectField(str);
        QueryWrapper<?> queryWrapper = new QueryWrapper<>();
        List arrayList = new ArrayList();
        boolean z = false;
        for (OnlCgformField onlCgformField : list) {
            if (OnlineConst.f140b.equals(onlCgformField.getDbIsPersist())) {
                String dbFieldName = onlCgformField.getDbFieldName();
                if ("id".equals(dbFieldName)) {
                    z = true;
                }
                arrayList.add(SqlInjectionUtil.getSqlInjectField(dbFieldName));
            }
        }
        if (!z) {
            arrayList.add("id");
        }
        if (!arrayList.isEmpty()) {
            queryWrapper.select(arrayList);
        }
        queryWrapper.eq(sqlInjectField, str2);
        return queryWrapper;
    }

    /* renamed from: a */
    public static void m351a(OnlCgformField onlCgformField, LoginUser loginUser, JSONObject jSONObject, String... strArr) {
        String dbFieldName = onlCgformField.getDbFieldName();
        boolean z = false;
        for (String str : strArr) {
            if (dbFieldName.toUpperCase().equals(str)) {
                if (onlCgformField.getIsShowForm().intValue() == 1) {
                    if (jSONObject.get(dbFieldName) == null) {
                        z = true;
                    }
                } else {
                    onlCgformField.setIsShowForm(1);
                    z = true;
                }
                if (z) {
                    if (str.equals(f226x)) {
                        jSONObject.put(dbFieldName, loginUser.getUsername());
                        return;
                    } else if (str.equals(f225w)) {
                        onlCgformField.setFieldShowType("datetime");
                        jSONObject.put(dbFieldName, DateUtils.formatDateTime());
                        return;
                    } else if (str.equals(f228z)) {
                        jSONObject.put(dbFieldName, loginUser.getUsername());
                        return;
                    } else if (str.equals(f227y)) {
                        onlCgformField.setFieldShowType("datetime");
                        jSONObject.put(dbFieldName, DateUtils.formatDateTime());
                        return;
                    } else if (str.equals(f229A)) {
                        jSONObject.put(dbFieldName, loginUser.getOrgCode());
                        return;
                    } else {
                        return;
                    }
                }
                return;
            }
        }
    }

    /* renamed from: a */
    public static boolean m379a(Object obj, Object obj2) {
        if (oConvertUtils.isEmpty(obj) && oConvertUtils.isEmpty(obj2)) {
            return true;
        }
        if (oConvertUtils.isNotEmpty(obj) && obj.equals(obj2)) {
            return true;
        }
        return false;
    }

    /* renamed from: a */
    public static boolean m350a(OnlCgformField onlCgformField, OnlCgformField onlCgformField2) {
        if (!OnlineConst.f140b.equals(onlCgformField2.getDbIsPersist()) && !OnlineConst.f140b.equals(onlCgformField.getDbIsPersist())) {
            return false;
        }
        if (!m379a((Object) onlCgformField.getDbFieldName(), (Object) onlCgformField2.getDbFieldName()) || !m379a((Object) onlCgformField.getDbFieldTxt(), (Object) onlCgformField2.getDbFieldTxt()) || !m379a(onlCgformField.getDbLength(), onlCgformField2.getDbLength()) || !m379a(onlCgformField.getDbPointLength(), onlCgformField2.getDbPointLength()) || !m379a((Object) onlCgformField.getDbType(), (Object) onlCgformField2.getDbType()) || !m379a(onlCgformField.getDbIsNull(), onlCgformField2.getDbIsNull()) || !m379a(onlCgformField.getDbIsPersist(), onlCgformField2.getDbIsPersist()) || !m379a(onlCgformField.getDbIsKey(), onlCgformField2.getDbIsKey()) || !m379a((Object) onlCgformField.getDbDefaultVal(), (Object) onlCgformField2.getDbDefaultVal())) {
            return true;
        }
        return false;
    }

    /* renamed from: a */
    public static boolean m347a(OnlCgformIndex onlCgformIndex, OnlCgformIndex onlCgformIndex2) {
        if (!m379a((Object) onlCgformIndex.getIndexName(), (Object) onlCgformIndex2.getIndexName()) || !m379a((Object) onlCgformIndex.getIndexField(), (Object) onlCgformIndex2.getIndexField()) || !m379a((Object) onlCgformIndex.getIndexType(), (Object) onlCgformIndex2.getIndexType())) {
            return true;
        }
        return false;
    }

    /* renamed from: a */
    public static boolean m348a(OnlCgformHead onlCgformHead, OnlCgformHead onlCgformHead2) {
        if (!m379a((Object) onlCgformHead.getTableName(), (Object) onlCgformHead2.getTableName()) || !m379a((Object) onlCgformHead.getTableTxt(), (Object) onlCgformHead2.getTableTxt())) {
            return true;
        }
        return false;
    }

    /* renamed from: a */
    public static String m370a(String str, List<OnlCgformField> list, Map<String, Object> map) {
        StringBuffer stringBuffer = new StringBuffer();
        StringBuffer stringBuffer2 = new StringBuffer();
        String str2 = str + "@";
        HashMap hashMap = new HashMap(5);
        for (String str3 : map.keySet()) {
            if (str3.startsWith(str2)) {
                hashMap.put(str3.replace(str2, ""), map.get(str3));
            } else {
                hashMap.put(str3, map.get(str3));
            }
        }
        for (OnlCgformField onlCgformField : list) {
            String dbFieldName = onlCgformField.getDbFieldName();
            String dbType = onlCgformField.getDbType();
            if (onlCgformField.getIsShowList().intValue() == 1) {
                stringBuffer2.append(f233E + dbFieldName);
            }
            if (oConvertUtils.isNotEmpty(onlCgformField.getMainField())) {
                String singleQueryConditionSql = QueryGenerator.getSingleQueryConditionSql(dbFieldName, "", hashMap.get(dbFieldName), !OnlineDbHandler.m286a(dbType));
                if (!"".equals(singleQueryConditionSql)) {
                    stringBuffer.append(f207e + singleQueryConditionSql);
                }
            }
            if (onlCgformField.getIsQuery().intValue() == 1) {
                if ("single".equals(onlCgformField.getQueryMode())) {
                    if (hashMap.get(dbFieldName) != null) {
                        String singleQueryConditionSql2 = QueryGenerator.getSingleQueryConditionSql(dbFieldName, "", hashMap.get(dbFieldName), !OnlineDbHandler.m286a(dbType));
                        if (!"".equals(singleQueryConditionSql2)) {
                            stringBuffer.append(f207e + singleQueryConditionSql2);
                        }
                    }
                } else {
                    Object obj = hashMap.get(dbFieldName + "_begin");
                    if (obj != null) {
                        stringBuffer.append(f207e + dbFieldName + f217o);
                        if (OnlineDbHandler.m286a(dbType)) {
                            stringBuffer.append(obj.toString());
                        } else {
                            stringBuffer.append(f231C + obj.toString() + f231C);
                        }
                    }
                    Object obj2 = hashMap.get(dbFieldName + "_end");
                    if (obj2 != null) {
                        stringBuffer.append(f207e + dbFieldName + f219q);
                        if (OnlineDbHandler.m286a(dbType)) {
                            stringBuffer.append(obj2.toString());
                        } else {
                            stringBuffer.append(f231C + obj2.toString() + f231C);
                        }
                    }
                }
            }
        }
        return "SELECT id" + stringBuffer2.toString() + f204b + m317f(str) + f210h + stringBuffer.toString() + m340b(str, list, hashMap);
    }

    /* renamed from: b */
    public static String m340b(String str, List<OnlCgformField> list, Map<String, Object> map) {
        boolean z = true;
        JSONArray m336b = m336b(map);
        MatchTypeEnum m327c = m327c(map);
        StringBuilder sb = new StringBuilder();
        if (m336b != null) {
            for (int i = 0; i < m336b.size(); i++) {
                JSONObject jSONObject = m336b.getJSONObject(i);
                String[] split = jSONObject.getString("field").split(f233E);
                if (split.length != 1) {
                    String str2 = split[1];
                    if (str.equalsIgnoreCase(split[0]) && m331c(str2, list)) {
                        m369a(sb, str2, jSONObject, m327c, null, z);
                        z = false;
                    }
                }
            }
        }
        String sb2 = sb.toString();
        if (sb2 == null || "".equals(sb2)) {
            return "";
        }
        return " AND (" + sb2 + ") ";
    }

    /* renamed from: c */
    public static boolean m331c(String str, List<OnlCgformField> list) {
        boolean z = false;
        Iterator<OnlCgformField> it = list.iterator();
        while (true) {
            if (!it.hasNext()) {
                break;
            }
            if (oConvertUtils.camelToUnderline(str).equalsIgnoreCase(it.next().getDbFieldName())) {
                z = true;
                break;
            }
        }
        return z;
    }

    @Deprecated
    /* renamed from: b */
    public static List<ExcelExportEntity> m338b(List<OnlCgformField> list, String str) {
        ArrayList arrayList = new ArrayList();
        for (int i = 0; i < list.size(); i++) {
            if ((null == str || !str.equals(list.get(i).getDbFieldName())) && list.get(i).getIsShowList().intValue() == 1) {
                ExcelExportEntity excelExportEntity = new ExcelExportEntity(list.get(i).getDbFieldTxt(), list.get(i).getDbFieldName());
                int intValue = list.get(i).getDbLength().intValue() == 0 ? 12 : list.get(i).getDbLength().intValue() > 30 ? 30 : list.get(i).getDbLength().intValue();
                if ("date".equals(list.get(i).getFieldShowType())) {
                    excelExportEntity.setFormat("yyyy-MM-dd");
                } else if ("datetime".equals(list.get(i).getFieldShowType())) {
                    excelExportEntity.setFormat("yyyy-MM-dd HH:mm:ss");
                }
                if (intValue < 10) {
                    intValue = 10;
                }
                excelExportEntity.setWidth(intValue);
                arrayList.add(excelExportEntity);
            }
        }
        return arrayList;
    }

    /* renamed from: a */
    public static boolean m356a(OnlCgformEnhanceJava onlCgformEnhanceJava) {
        Class<?> cls;
        String cgJavaType = onlCgformEnhanceJava.getCgJavaType();
        String cgJavaValue = onlCgformEnhanceJava.getCgJavaValue();
        if (oConvertUtils.isNotEmpty(cgJavaValue)) {
            try {
                if ("class".equals(cgJavaType) && ((cls = Class.forName(cgJavaValue)) == null || cls.newInstance() == null)) {
                    return false;
                }
                if ("spring".equals(cgJavaType)) {
                    if (SpringContextUtils.getBean(cgJavaValue) == null) {
                        return false;
                    }
                    return true;
                }
                return true;
            } catch (Exception e) {
                f202aZ.error(e.getMessage(), e);
                return false;
            }
        }
        return true;
    }

    /* renamed from: b */
    public static void m339b(List<String> list) {
        Collections.sort(list, new C0012b());
    }

    /* renamed from: c */
    public static void m329c(List<String> list) {
        Collections.sort(list, new C0011a());
    }

    /* renamed from: a */
    public static String m377a(String str, JSONObject jSONObject) {
        if (jSONObject == null) {
            return str;
        }
        String replace = str.replace("#{UUID}", UUIDGenerator.generate());
        for (String str2 : QueryGenerator.getSqlRuleParams(replace)) {
            if (jSONObject.get(str2.toUpperCase()) == null && jSONObject.get(str2.toLowerCase()) == null) {
                String userSystemData = JwtUtil.getUserSystemData(str2, (SysUserCacheInfo) null);
                if (userSystemData == null) {
                    replace = replace.replace("'#{" + str2 + "}'", "NULL").replace("#{" + str2 + "}", "NULL");
                } else {
                    replace = replace.replace("#{" + str2 + "}", userSystemData);
                }
            } else {
                String str3 = null;
                if (jSONObject.containsKey(str2.toLowerCase())) {
                    str3 = jSONObject.getString(str2.toLowerCase());
                } else if (jSONObject.containsKey(str2.toUpperCase())) {
                    str3 = jSONObject.getString(str2.toUpperCase());
                }
                replace = replace.replace("#{" + str2 + "}", str3);
            }
        }
        return replace;
    }

    /* renamed from: d */
    public static String m324d(String str, List<OnlCgformButton> list) {
        String[] split;
        String m319e = m319e(str, list);
        for (String str2 : f306ba.split(f233E)) {
            if ("beforeAdd,afterAdd,mounted,created".indexOf(str2) >= 0) {
                Matcher matcher = Pattern.compile("(" + str2 + "\\s*\\(\\)\\s*\\{)").matcher(m319e);
                if (matcher.find()) {
                    m319e = m319e.replace(matcher.group(0), str2 + "(that){const getAction=this._getAction,postAction=this._postAction,deleteAction=this._deleteAction;");
                }
            } else {
                Matcher matcher2 = Pattern.compile("(" + str2 + "\\s*\\(row\\)\\s*\\{)").matcher(m319e);
                if (matcher2.find()) {
                    m319e = m319e.replace(matcher2.group(0), str2 + "(that,row){const getAction=this._getAction,postAction=this._postAction,deleteAction=this._deleteAction;");
                } else {
                    Matcher matcher3 = Pattern.compile("(" + str2 + "\\s*\\(\\)\\s*\\{)").matcher(m319e);
                    if (matcher3.find()) {
                        m319e = m319e.replace(matcher3.group(0), str2 + "(that){const getAction=this._getAction,postAction=this._postAction,deleteAction=this._deleteAction;");
                    }
                }
            }
        }
        return m325d(m319e);
    }

    /* renamed from: a */
    public static void m354a(OnlCgformEnhanceJs onlCgformEnhanceJs, String str, List<OnlCgformField> list) {
        if (onlCgformEnhanceJs == null || oConvertUtils.isEmpty(onlCgformEnhanceJs.getCgJs())) {
            return;
        }
        String cgJs = onlCgformEnhanceJs.getCgJs();
        Matcher matcher = Pattern.compile("(" + str + "_" + CgformConstant.f373h + "\\s*\\(\\)\\s*\\{)").matcher(cgJs);
        if (matcher.find()) {
            cgJs = cgJs.replace(matcher.group(0), str + "_" + CgformConstant.f373h + "(){const getAction=this._getAction,postAction=this._postAction,deleteAction=this._deleteAction;");
            for (OnlCgformField onlCgformField : list) {
                Matcher matcher2 = Pattern.compile("(" + onlCgformField.getDbFieldName() + "\\s*\\(\\))").matcher(cgJs);
                if (matcher2.find()) {
                    cgJs = cgJs.replace(matcher2.group(0), onlCgformField.getDbFieldName() + "(that,event)");
                }
            }
        }
        onlCgformEnhanceJs.setCgJs(cgJs);
    }

    /* renamed from: a */
    public static void m353a(OnlCgformEnhanceJs onlCgformEnhanceJs, String str, List<OnlCgformField> list, boolean z) {
        if (onlCgformEnhanceJs == null || oConvertUtils.isEmpty(onlCgformEnhanceJs.getCgJs())) {
            return;
        }
        String cgJs = onlCgformEnhanceJs.getCgJs();
        Matcher matcher = Pattern.compile("([^_]" + CgformConstant.f373h + "\\s*\\(\\)\\s*\\{)").matcher(cgJs);
        if (matcher.find()) {
            cgJs = cgJs.replace(matcher.group(0), CgformConstant.f373h + "(){const getAction=this._getAction,postAction=this._postAction,deleteAction=this._deleteAction;");
            for (OnlCgformField onlCgformField : list) {
                Matcher matcher2 = Pattern.compile("(" + onlCgformField.getDbFieldName() + "\\s*\\(\\))").matcher(cgJs);
                if (matcher2.find()) {
                    cgJs = cgJs.replace(matcher2.group(0), onlCgformField.getDbFieldName() + "(that,event)");
                }
            }
        }
        onlCgformEnhanceJs.setCgJs(cgJs);
        m355a(onlCgformEnhanceJs);
        m354a(onlCgformEnhanceJs, str, list);
    }

    /* renamed from: a */
    public static void m355a(OnlCgformEnhanceJs onlCgformEnhanceJs) {
        String cgJs = onlCgformEnhanceJs.getCgJs();
        Matcher matcher = Pattern.compile("(show\\s*\\(\\)\\s*\\{)").matcher(cgJs);
        if (matcher.find()) {
            cgJs = cgJs.replace(matcher.group(0), "show(that){const getAction=this._getAction,postAction=this._postAction,deleteAction=this._deleteAction;");
        }
        onlCgformEnhanceJs.setCgJs(cgJs);
    }

    /* renamed from: d */
    public static String m325d(String str) {
        return "class OnlineEnhanceJs{constructor(getAction,postAction,deleteAction){this._getAction=getAction;this._postAction=postAction;this._deleteAction=deleteAction;}" + str + "}";
    }

    /* renamed from: e */
    public static String m319e(String str, List<OnlCgformButton> list) {
        if (list != null) {
            for (OnlCgformButton onlCgformButton : list) {
                String buttonCode = onlCgformButton.getButtonCode();
                if ("link".equals(onlCgformButton.getButtonStyle())) {
                    Matcher matcher = Pattern.compile("(" + buttonCode + "\\s*\\(row\\)\\s*\\{)").matcher(str);
                    if (matcher.find()) {
                        str = str.replace(matcher.group(0), buttonCode + "(that,row){const getAction=this._getAction,postAction=this._postAction,deleteAction=this._deleteAction;");
                    } else {
                        Matcher matcher2 = Pattern.compile("(" + buttonCode + "\\s*\\(\\)\\s*\\{)").matcher(str);
                        if (matcher2.find()) {
                            str = str.replace(matcher2.group(0), buttonCode + "(that){const getAction=this._getAction,postAction=this._postAction,deleteAction=this._deleteAction;");
                        }
                    }
                } else if ("button".equals(onlCgformButton.getButtonStyle()) || f271aq.equals(onlCgformButton.getButtonStyle())) {
                    Matcher matcher3 = Pattern.compile("(" + buttonCode + "\\s*\\(\\)\\s*\\{)").matcher(str);
                    if (matcher3.find()) {
                        str = str.replace(matcher3.group(0), buttonCode + "(that){const getAction=this._getAction,postAction=this._postAction,deleteAction=this._deleteAction;");
                    }
                }
            }
        }
        return str;
    }

    /* renamed from: a */
    public static JSONArray m363a(List<OnlCgformField> list, List<String> list2) {
        String[] split;
        JSONArray jSONArray = new JSONArray();
        ISysBaseAPI iSysBaseAPI = (ISysBaseAPI) SpringContextUtils.getBean(ISysBaseAPI.class);
        for (OnlCgformField onlCgformField : list) {
            String dbFieldName = onlCgformField.getDbFieldName();
            if (!"id".equals(dbFieldName)) {
                JSONObject jSONObject = new JSONObject();
                if (list2 != null && list2.indexOf(dbFieldName) >= 0) {
                    jSONObject.put("disabled", true);
                }
                if (onlCgformField.getIsReadOnly() != null && 1 == onlCgformField.getIsReadOnly().intValue()) {
                    jSONObject.put("disabled", true);
                }
                jSONObject.put(f298aR, onlCgformField.getDbFieldTxt());
                jSONObject.put("key", dbFieldName);
                String m321d = m321d(onlCgformField);
                jSONObject.put("type", m321d);
                if (onlCgformField.getFieldLength() == null) {
                    onlCgformField.setFieldLength(186);
                }
                if (("sel_depart".equals(m321d) || "sel_user".equals(m321d)) && onlCgformField.getFieldLength().intValue() < 170) {
                    jSONObject.put("width", "170px");
                } else if ("date".equals(m321d) && onlCgformField.getFieldLength().intValue() < 140) {
                    jSONObject.put("width", "140px");
                } else if ("datetime".equals(m321d) && onlCgformField.getFieldLength().intValue() < 190) {
                    jSONObject.put("width", "190px");
                } else {
                    jSONObject.put("width", onlCgformField.getFieldLength() + "px");
                }
                if ("file".equals(m321d) || "image".equals(m321d)) {
                    jSONObject.put("responseName", "message");
                    jSONObject.put("token", true);
                }
                if (f240L.equals(m321d)) {
                    jSONObject.put("type", "checkbox");
                    JSONArray jSONArray2 = new JSONArray();
                    jSONArray2.add("Y");
                    jSONArray2.add("N");
                    if (oConvertUtils.isNotEmpty(onlCgformField.getFieldExtendJson())) {
                        try {
                            jSONArray2 = JSONArray.parseArray(onlCgformField.getFieldExtendJson());
                        } catch (Exception e) {
                            JSONObject parseObject = JSONArray.parseObject(onlCgformField.getFieldExtendJson());
                            if (parseObject.containsKey(f302aV)) {
                                jSONArray2 = parseObject.getJSONArray(f302aV);
                            }
                        }
                    }
                    jSONObject.put("customValue", jSONArray2);
                }
                if (f241M.equals(m321d)) {
                    jSONObject.put("popupCode", onlCgformField.getDictTable());
                    jSONObject.put("orgFields", onlCgformField.getDictField());
                    jSONObject.put("destFields", onlCgformField.getDictText());
                    String dictText = onlCgformField.getDictText();
                    if (dictText != null && !"".equals(dictText)) {
                        ArrayList arrayList = new ArrayList();
                        for (String str : dictText.split(f233E)) {
                            if (!m373a(str, list)) {
                                arrayList.add(str);
                                JSONObject jSONObject2 = new JSONObject();
                                jSONObject2.put(f298aR, str);
                                jSONObject2.put("key", str);
                                jSONObject2.put("type", "hidden");
                                jSONArray.add(jSONObject2);
                            }
                        }
                    }
                }
                jSONObject.put("defaultValue", onlCgformField.getDbDefaultVal());
                jSONObject.put("fieldDefaultValue", onlCgformField.getFieldDefaultValue());
                jSONObject.put("placeholder", "请输入" + onlCgformField.getDbFieldTxt());
                jSONObject.put("validateRules", m326c(onlCgformField));
                if (f272ar.equals(onlCgformField.getFieldShowType()) || "radio".equals(onlCgformField.getFieldShowType()) || "checkbox_meta".equals(onlCgformField.getFieldShowType()) || "list_multi".equals(onlCgformField.getFieldShowType()) || "sel_search".equals(onlCgformField.getFieldShowType())) {
                    jSONObject.put(view, onlCgformField.getFieldShowType());
                    jSONObject.put("dictTable", onlCgformField.getDictTable());
                    jSONObject.put("dictText", onlCgformField.getDictText());
                    jSONObject.put("dictCode", onlCgformField.getDictField());
                    if ("list_multi".equals(onlCgformField.getFieldShowType())) {
                        jSONObject.put("width", "230px");
                    }
                }
                jSONObject.put("fieldExtendJson", onlCgformField.getFieldExtendJson());
                jSONArray.add(jSONObject);
            }
        }
        return jSONArray;
    }

    /* renamed from: c */
    private static JSONArray m326c(OnlCgformField onlCgformField) {
        JSONArray jSONArray = new JSONArray();
        if (onlCgformField.getDbIsNull().intValue() == 0 || "1".equals(onlCgformField.getFieldMustInput())) {
            JSONObject jSONObject = new JSONObject();
            jSONObject.put("required", true);
            jSONObject.put("message", onlCgformField.getDbFieldTxt() + "不能为空!");
            jSONArray.add(jSONObject);
        }
        if (oConvertUtils.isNotEmpty(onlCgformField.getFieldValidType())) {
            JSONObject jSONObject2 = new JSONObject();
            if ("only".equals(onlCgformField.getFieldValidType())) {
                jSONObject2.put("unique", true);
                jSONObject2.put("message", onlCgformField.getDbFieldTxt() + "不能重复");
            } else {
                jSONObject2.put("pattern", onlCgformField.getFieldValidType());
                String m376a = m376a(ExtendJsonKey.f136i, onlCgformField.getFieldExtendJson());
                if (oConvertUtils.isEmpty(m376a)) {
                    CgformValidPatternEnum patternInfoByType = CgformValidPatternEnum.getPatternInfoByType(onlCgformField.getFieldValidType());
                    if (null == patternInfoByType) {
                        jSONObject2.put("message", onlCgformField.getDbFieldTxt() + "格式不正确");
                    } else {
                        jSONObject2.put("message", patternInfoByType.getMsg());
                    }
                } else {
                    jSONObject2.put("message", m376a);
                }
            }
            jSONArray.add(jSONObject2);
        }
        return jSONArray;
    }

    /* renamed from: a */
    public static Map<String, Object> m361a(Map<String, Object> map) {
        Map hashMap = new HashMap(5);
        if (map == null || map.isEmpty()) {
            return hashMap;
        }
        for (String str : map.keySet()) {
        	Object str2 = map.get(str);
            if (str2 instanceof Clob) {
                str2 = m368a((Clob) str2);
            } else if (str2 instanceof byte[]) {
                str2 = new String((byte[]) str2);
            } else if (str2 instanceof Blob) {
                if (str2 != null) {
                    try {
                        Blob blob = (Blob) str2;
                        str2 = new String(blob.getBytes(1L, (int) blob.length()), "UTF-8");
                    } catch (Exception e) {
                        e.printStackTrace();
                    }
                }
            }
            hashMap.put(str.toLowerCase(), str2 == null ? "" : str2);
        }
        return hashMap;
    }

    /* renamed from: a */
    public static JSONObject m383a(JSONObject jSONObject) {
        if (DbTableUtil.m39a()) {
            JSONObject jSONObject2 = new JSONObject();
            if (jSONObject == null || jSONObject.isEmpty()) {
                return jSONObject2;
            }
            for (String str : jSONObject.keySet()) {
                jSONObject2.put(str.toLowerCase(), jSONObject.get(str));
            }
            return jSONObject2;
        }
        return jSONObject;
    }

    /* renamed from: a */
    public static List<Map<String, Object>> m384a(JSONArray jSONArray) {
    	List<Map<String, Object>> list = jSONArray.stream().map(obj -> {
            return (JSONObject) obj;
        }).collect(Collectors.toList());
    	
        return m364a(list, null);
    }

    /* renamed from: d */
    public static List<Map<String, Object>> m322d(List<Map<String, Object>> list) {
        return m364a(list, (Collection<String>) null);
    }

    /* renamed from: a */
    public static List<Map<String, Object>> m364a(List<Map<String, Object>> list, Collection<String> collection) {
        List arrayList = new ArrayList();
        for (Map<String, Object> map : list) {
            if (map != null) {
                Map hashMap = new HashMap(5);
                for (String str : map.keySet()) {
                	Object str2 = map.get(str);
                    if (str2 instanceof Clob) {
                        str2 = m368a((Clob) str2);
                    } else if (str2 instanceof byte[]) {
                        str2 = new String((byte[]) str2);
                    } else if (str2 instanceof Long) {
                        if (str2 != null) {
                            str2 = String.valueOf(str2);
                        }
                    } else if (str2 instanceof Blob) {
                        if (str2 != null) {
                            try {
                                Blob blob = (Blob) str2;
                                str2 = new String(blob.getBytes(1L, (int) blob.length()), "UTF-8");
                            } catch (Exception e) {
                                e.printStackTrace();
                            }
                        }
                    }
                    hashMap.put(str.toLowerCase(), str2 == null ? "" : str2);
                }
                hashMap.put(f222t, m359a((Map<String, Object>) hashMap, collection));
                arrayList.add(hashMap);
            }
        }
        return arrayList;
    }

    /* renamed from: a */
    private static String m359a(Map<String, Object> map, Collection<String> collection) {
        String obj2 = map.containsKey("id") ? map.get("id").toString() : null;
        if (oConvertUtils.isNotEmpty(obj2) && collection != null) {
            Iterator<String> it = collection.iterator();
            while (it.hasNext()) {
                if (map.get(it.next().toLowerCase() + "_id") == null) {
                    obj2 = obj2 + "@";
                } else {
                    obj2 = obj2 + "@";
                }
            }
        }
        return obj2;
    }

    /* renamed from: a */
    public static String m368a(Clob clob) {
        String str = "";
        try {
            Reader characterStream = clob.getCharacterStream();
            char[] cArr = new char[(int) clob.length()];
            characterStream.read(cArr);
            str = new String(cArr);
            characterStream.close();
        } catch (IOException e) {
            e.printStackTrace();
        } catch (SQLException e2) {
            e2.printStackTrace();
        }
        return str;
    }

    /* renamed from: c */
    public static Map<String, Object> m330c(String str, List<OnlCgformField> list, JSONObject jSONObject) {
        StringBuffer stringBuffer = new StringBuffer();
        StringBuffer stringBuffer2 = new StringBuffer();
        String str2 = "";
        try {
            str2 = DbTableUtil.getDatabaseType();
        } catch (SQLException e) {
            e.printStackTrace();
        } catch (DBException e2) {
            e2.printStackTrace();
        }
        HashMap hashMap = new HashMap(5);
        boolean z = false;
        String str3 = null;
        LoginUser loginUser = (LoginUser) SecurityUtils.getSubject().getPrincipal();
        if (loginUser == null) {
            String userNameByToken = JwtUtil.getUserNameByToken(SpringContextUtils.getHttpServletRequest());
            if (oConvertUtils.isNotEmpty(userNameByToken)) {
                loginUser = new LoginUser();
                loginUser.setUsername(userNameByToken);
            } else {
                throw new TuringBootException("online保存表单数据异常:系统未找到当前登陆用户信息");
            }
        }
        String sqlInjectTableName = SqlInjectionUtil.getSqlInjectTableName(m317f(str));
        boolean m310j = m310j(sqlInjectTableName);
        for (OnlCgformField onlCgformField : list) {
            String sqlInjectField = SqlInjectionUtil.getSqlInjectField(onlCgformField.getDbFieldName());
            if (null != sqlInjectField && (jSONObject.get(sqlInjectField) != null || f226x.equalsIgnoreCase(sqlInjectField) || f225w.equalsIgnoreCase(sqlInjectField) || f229A.equalsIgnoreCase(sqlInjectField))) {
                if (!m310j || !"tenant_id".equalsIgnoreCase(sqlInjectField)) {
                    m351a(onlCgformField, loginUser, jSONObject, f226x, f225w, f229A);
                    if ("".equals(jSONObject.get(sqlInjectField))) {
                        String dbType = onlCgformField.getDbType();
                        if (!OnlineDbHandler.m286a(dbType) && !OnlineDbHandler.m283b(dbType)) {
                        }
                    }
                    if ("id".equals(sqlInjectField.toLowerCase())) {
                        z = true;
                        str3 = jSONObject.getString(sqlInjectField);
                    } else if (!f264aj.equals(onlCgformField.getFieldShowType()) || OnlineConst.f140b.equals(onlCgformField.getDbIsPersist())) {
                        stringBuffer.append(f233E + sqlInjectField);
                        stringBuffer2.append(f233E + OnlineDbHandler.m285a(str2, onlCgformField, jSONObject, hashMap));
                    }
                }
            }
        }
        if (!z || oConvertUtils.isEmpty(str3)) {
            str3 = m385a();
        }
        if (m310j) {
            stringBuffer.append(f233E + "tenant_id");
            stringBuffer2.append(",#{tenant_id}");
            hashMap.put("tenant_id", SpringContextUtils.getHttpServletRequest().getHeader("X-Tenant-Id"));
        }
        String str4 = "insert into " + sqlInjectTableName + "(id" + stringBuffer.toString() + ") values(" + f231C + str3 + f231C + stringBuffer2.toString() + ")";
        hashMap.put("execute_sql_string", str4);
        f202aZ.info("--表单设计器表单保存sql-->" + str4);
        hashMap.put("id", str3);
        return hashMap;
    }

    /* renamed from: d */
    public static Map<String, Object> m323d(String str, List<OnlCgformField> list, JSONObject jSONObject) {
        StringBuffer stringBuffer = new StringBuffer();
        HashMap hashMap = new HashMap(5);
        String str2 = "";
        try {
            str2 = DbTableUtil.getDatabaseType();
        } catch (SQLException e) {
            e.printStackTrace();
        } catch (DBException e2) {
            e2.printStackTrace();
        }
        LoginUser loginUser = (LoginUser) SecurityUtils.getSubject().getPrincipal();
        if (loginUser == null) {
            String userNameByToken = JwtUtil.getUserNameByToken(SpringContextUtils.getHttpServletRequest());
            if (oConvertUtils.isNotEmpty(userNameByToken)) {
                loginUser = new LoginUser();
                loginUser.setUsername(userNameByToken);
            } else {
                throw new TuringBootException("online保存表单数据异常:系统未找到当前登陆用户信息");
            }
        }
        for (OnlCgformField onlCgformField : list) {
            if (OnlineConst.f140b.equals(onlCgformField.getDbIsPersist())) {
                String dbFieldName = onlCgformField.getDbFieldName();
                if (null == dbFieldName) {
                    f202aZ.info("--------online修改表单数据遇见空名称的字段------->>" + onlCgformField.getId());
                } else if (!"id".equals(dbFieldName) && (jSONObject.get(dbFieldName) != null || f228z.equalsIgnoreCase(dbFieldName) || f227y.equalsIgnoreCase(dbFieldName) || f229A.equalsIgnoreCase(dbFieldName))) {
                    m351a(onlCgformField, loginUser, jSONObject, f228z, f227y, f229A);
                    if ("".equals(jSONObject.get(dbFieldName))) {
                        String dbType = onlCgformField.getDbType();
                        if (!OnlineDbHandler.m286a(dbType) && !OnlineDbHandler.m283b(dbType)) {
                        }
                    }
                    stringBuffer.append(dbFieldName + f215m + OnlineDbHandler.m285a(str2, onlCgformField, jSONObject, hashMap) + f233E);
                }
            }
        }
        String stringBuffer2 = stringBuffer.toString();
        if (stringBuffer2.endsWith(f233E)) {
            stringBuffer2 = stringBuffer2.substring(0, stringBuffer2.length() - 1);
        }
        String str3 = "update " + m317f(str) + " set " + stringBuffer2 + f211i + "id" + f215m + f231C + jSONObject.getString("id") + f231C;
        f202aZ.info("--表单设计器表单编辑sql-->" + str3);
        hashMap.put("execute_sql_string", str3);
        hashMap.put("id", jSONObject.getString("id"));
        return hashMap;
    }

    /* renamed from: a */
    public static Map<String, Object> m375a(String str, String str2, String str3) {
        HashMap hashMap = new HashMap(5);
        String str4 = "update " + m317f(str) + " set " + str2 + f215m + f231C + 0 + f231C + f211i + "id" + f215m + f231C + str3 + f231C;
        f202aZ.info("--修改树节点状态：为无子节点sql-->" + str4);
        hashMap.put("execute_sql_string", str4);
        return hashMap;
    }

    /* renamed from: e */
    public static String m320e(String str) {
        if (str == null || "".equals(str) || f304aX.equals(str)) {
            return "";
        }
        return "CODE like '" + str + "%" + f231C;
    }

    /* renamed from: f */
    public static String m317f(String str) {
        String str2;
        if (Pattern.matches("^[a-zA-z].*\\$\\d+$", str)) {
            str2 = str.substring(0, str.lastIndexOf(f224v));
        } else {
            str2 = str;
        }
        return SqlInjectionUtil.getSqlInjectTableName(str2);
    }

    /* renamed from: a */
    public static void m357a(LinkDownProperty linkDownProperty, List<OnlCgformField> list, List<String> list2, List<String> list3) {
        String string = JSONObject.parseObject(linkDownProperty.getDictTable()).getString("linkField");
        ArrayList arrayList = new ArrayList();
        if (oConvertUtils.isNotEmpty(string)) {
            String[] split = string.split(f233E);
            for (OnlCgformField onlCgformField : list) {
                String dbFieldName = onlCgformField.getDbFieldName();
                int length = split.length;
                int i = 0;
                while (true) {
                    if (i >= length) {
                        break;
                    } else if (!split[i].equals(dbFieldName)) {
                        i++;
                    } else {
                        list2.add(dbFieldName);
                        if ("1".equals(onlCgformField.getFieldMustInput())) {
                            list3.add(dbFieldName);
                        }
                        arrayList.add(new BaseColumn(onlCgformField.getDbFieldTxt(), dbFieldName, onlCgformField.getOrderNum(), onlCgformField.getFieldDefaultValue()));
                    }
                }
            }
        }
        linkDownProperty.setOtherColumns(arrayList);
    }

    /* renamed from: a */
    public static String m346a(byte[] bArr, String str, String str2, String str3) {
        return CommonUtils.uploadOnlineImage(bArr, str, str2, str3);
    }

    /* renamed from: e */
    public static List<String> m318e(List<OnlCgformField> list) {
        ArrayList arrayList = new ArrayList();
        for (OnlCgformField onlCgformField : list) {
            if ("image".equals(onlCgformField.getFieldShowType())) {
                arrayList.add(onlCgformField.getDbFieldTxt());
            }
        }
        return arrayList;
    }

    /* renamed from: c */
    public static List<String> m328c(List<OnlCgformField> list, String str) {
        ArrayList arrayList = new ArrayList();
        for (OnlCgformField onlCgformField : list) {
            if ("image".equals(onlCgformField.getFieldShowType())) {
                arrayList.add(str + "_" + onlCgformField.getDbFieldTxt());
            }
        }
        return arrayList;
    }

    /* renamed from: a */
    public static String m385a() {
        return String.valueOf(IdWorker.getId());
    }

    /* renamed from: a */
    public static String m382a(Exception exc) {
        String message = exc.getCause() != null ? exc.getCause().getMessage() : exc.getMessage();
        if (message == null) {
            return "未知错误";
        }
        if (message.indexOf("ORA-01452") != -1) {
            message = "ORA-01452: 无法 CREATE UNIQUE INDEX; 找到重复的关键字";
        } else if (message.indexOf("duplicate key") != -1) {
            message = "无法 CREATE UNIQUE INDEX; 找到重复的关键字";
        }
        return message;
    }

    /* renamed from: b */
    public static List<DictModel> m334b(OnlCgformField onlCgformField) {
        ArrayList arrayList = new ArrayList();
        String fieldExtendJson = onlCgformField.getFieldExtendJson();
        JSONArray parseArray = JSONArray.parseArray("[\"Y\",\"N\"]");
        if (oConvertUtils.isNotEmpty(fieldExtendJson)) {
            try {
                parseArray = JSONArray.parseArray(fieldExtendJson);
            } catch (JSONException e) {
                JSONObject parseObject = JSONArray.parseObject(fieldExtendJson);
                if (parseObject.containsKey(f302aV)) {
                    parseArray = parseObject.getJSONArray(f302aV);
                }
            }
        }
        DictModel dictModel = new DictModel(parseArray.getString(0), "是");
        DictModel dictModel2 = new DictModel(parseArray.getString(1), "否");
        arrayList.add(dictModel);
        arrayList.add(dictModel2);
        return arrayList;
    }

    /* renamed from: d */
    private static String m321d(OnlCgformField onlCgformField) {
        if ("checkbox".equals(onlCgformField.getFieldShowType())) {
            return "checkbox";
        }
        if (OnlFormShowType.f321e.equals(onlCgformField.getFieldShowType())) {
            return OnlFormShowType.f321e;
        }
        if (f272ar.equals(onlCgformField.getFieldShowType())) {
            return "select";
        }
        if (f240L.equals(onlCgformField.getFieldShowType())) {
            return f240L;
        }
        if ("sel_user".equals(onlCgformField.getFieldShowType())) {
            return "sel_user";
        }
        if ("sel_depart".equals(onlCgformField.getFieldShowType())) {
            return "sel_depart";
        }
        if (DataBaseConst.f580k.equals(onlCgformField.getFieldShowType())) {
            return DataBaseConst.f580k;
        }
        if ("image".equals(onlCgformField.getFieldShowType()) || "file".equals(onlCgformField.getFieldShowType()) || "radio".equals(onlCgformField.getFieldShowType()) || f241M.equals(onlCgformField.getFieldShowType()) || "list_multi".equals(onlCgformField.getFieldShowType()) || "sel_search".equals(onlCgformField.getFieldShowType())) {
            return onlCgformField.getFieldShowType();
        }
        if ("datetime".equals(onlCgformField.getFieldShowType())) {
            return "datetime";
        }
        if ("date".equals(onlCgformField.getFieldShowType())) {
            return "date";
        }
        if ("time".equals(onlCgformField.getFieldShowType())) {
            return "time";
        }
        if ("int".equals(onlCgformField.getDbType()) || "double".equals(onlCgformField.getDbType()) || "BigDecimal".equals(onlCgformField.getDbType())) {
            return "inputNumber";
        }
        return "input";
    }

    public static String getDatabseType() {
        if (oConvertUtils.isNotEmpty(f307bb)) {
            return f307bb;
        }
        try {
            f307bb = DbTableUtil.getDatabaseType();
            return f307bb;
        } catch (Exception e) {
            e.printStackTrace();
            return f307bb;
        }
    }

    /* renamed from: f */
    public static List<String> m315f(List<String> list) {
        ArrayList arrayList = new ArrayList();
        for (String str : list) {
            arrayList.add(str.toLowerCase());
        }
        return arrayList;
    }

    /* renamed from: b */
    private static String m343b(String str, String str2) {
        String str3 = "";
        if (str2 == null || "".equals(str2)) {
            return str3;
        }
        String[] split = str2.split(f233E);
        for (int i = 0; i < split.length; i++) {
            if (i > 0) {
                str3 = str3 + f207e;
            }
            String str4 = str3 + str + f208f;
            if ("SQLSERVER".equals(getDatabseType())) {
                str4 = str4 + "N";
            }
            str3 = str4 + "'%" + split[i] + "%" + f231C;
        }
        f202aZ.info(" POPUP fieldSql: " + str3);
        return str3;
    }

    /* renamed from: a */
    public static String m374a(String str, String str2, StringBuffer stringBuffer) {
        String str3 = "logs" + File.separator + ((SimpleDateFormat) DateUtils.yyyyMMdd.get()).format(new Date()) + File.separator;
        String str4 = str + File.separator + str3;
        File file = new File(str4);
        if (!file.exists()) {
            file.mkdirs();
        }
        String str5 = str2 + Math.round(Math.random() * 10000.0d);
        try {
            BufferedWriter bufferedWriter = new BufferedWriter(new FileWriter(str4 + str5 + ".txt"));
            bufferedWriter.write(stringBuffer.toString());
            bufferedWriter.flush();
            bufferedWriter.close();
        } catch (Exception e) {
            f202aZ.info("excel导入生成错误日志文件异常:" + e.getMessage());
        }
        return "/sys/common/static/" + str3 + str5 + ".txt";
    }

    /* JADX WARN: Multi-variable type inference failed */
    /* JADX WARN: Type inference failed for: r0v36, types: [java.util.List] */
    /* JADX WARN: Type inference failed for: r0v43, types: [java.util.List] */
    /* JADX WARN: Type inference failed for: r0v72, types: [java.util.List] */
    /* JADX WARN: Type inference failed for: r0v79, types: [java.util.List] */
    /* renamed from: b */
    public static JSONObject m345b(JSONObject jSONObject) {
        JSONObject jSONObject2;
        if (jSONObject.containsKey(properties)) {
            jSONObject2 = jSONObject.getJSONObject(properties);
        } else {
            jSONObject2 = jSONObject.getJSONObject("schema").getJSONObject(properties);
        }
        ISysBaseAPI iSysBaseAPI = (ISysBaseAPI) SpringContextUtils.getBean(ISysBaseAPI.class);
        for (String str : jSONObject2.keySet()) {
            JSONObject jSONObject3 = jSONObject2.getJSONObject(str);
            String string = jSONObject3.getString(view);
            if (m332c(string)) {
                String string2 = jSONObject3.getString("dictCode");
                String string3 = jSONObject3.getString("dictText");
                String string4 = jSONObject3.getString("dictTable");
                List arrayList = new ArrayList();
                if (oConvertUtils.isNotEmpty(string4)) {
                    arrayList = iSysBaseAPI.queryTableDictItemsByCode(string4, string3, string2);
                } else if (oConvertUtils.isNotEmpty(string2)) {
                    arrayList = iSysBaseAPI.queryEnableDictItemsByCode(string2);
                }
                if (arrayList != null && arrayList.size() > 0) {
                    jSONObject3.put("enum", arrayList.stream().filter((v0) -> {
                        return Objects.nonNull(v0);
                    }).collect(Collectors.toList()));
                }
            } else if ("tab".equals(string)) {
                if ("1".equals(jSONObject3.getString("relationType"))) {
                    m345b(jSONObject3);
                } else {
                    JSONArray jSONArray = jSONObject3.getJSONArray("columns");
                    for (int i = 0; i < jSONArray.size(); i++) {
                        JSONObject jSONObject4 = jSONArray.getJSONObject(i);
                        if (m333c(jSONObject4)) {
                            String string5 = jSONObject4.getString("dictCode");
                            String string6 = jSONObject4.getString("dictText");
                            String string7 = jSONObject4.getString("dictTable");
                            List arrayList2 = new ArrayList();
                            if (oConvertUtils.isNotEmpty(string7)) {
                                arrayList2 = iSysBaseAPI.queryTableDictItemsByCode(string7, string6, string5);
                            } else if (oConvertUtils.isNotEmpty(string5)) {
                                arrayList2 = iSysBaseAPI.queryEnableDictItemsByCode(string5);
                            }
                            if (arrayList2 != null && arrayList2.size() > 0) {
                                jSONObject4.put("options", arrayList2);
                            }
                        }
                    }
                }
            }
        }
        return jSONObject;
    }

    /* renamed from: c */
    private static boolean m333c(JSONObject jSONObject) {
        Object obj = jSONObject.get(view);
        if (obj != null) {
            String obj2 = obj.toString();
            if (f272ar.equals(obj2) || "radio".equals(obj2) || "checkbox_meta".equals(obj2) || "list_multi".equals(obj2) || "sel_search".equals(obj2)) {
                return true;
            }
            return false;
        }
        return false;
    }

    /* renamed from: b */
    public static JSONArray m336b(Map<String, Object> map) {
        Object obj = map.get("superQueryParams");
        if (obj != null) {
            try {
                return JSONArray.parseArray(URLDecoder.decode(obj.toString(), "UTF-8"));
            } catch (UnsupportedEncodingException e) {
                f202aZ.error("高级查询json参数转换失败" + e.getMessage());
                return null;
            }
        }
        return null;
    }

    /* renamed from: c */
    public static MatchTypeEnum m327c(Map<String, Object> map) {
        MatchTypeEnum byValue = MatchTypeEnum.getByValue(map.get("superQueryMatchType"));
        if (byValue == null) {
            byValue = MatchTypeEnum.AND;
        }
        return byValue;
    }

    /* renamed from: g */
    public static boolean m314g(String str) {
        for (int i = 0; i < str.length(); i++) {
            char charAt = str.charAt(i);
            if (charAt != '.' && charAt != '-' && charAt != '+' && !Character.isDigit(charAt)) {
                return false;
            }
        }
        return true;
    }

    /* renamed from: g */
    public static List<OnlineFieldConfig> m313g(List<OnlCgformField> list) {
        ArrayList arrayList = new ArrayList();
        for (OnlCgformField onlCgformField : list) {
            if (OnlineConst.f140b.equals(onlCgformField.getDbIsPersist())) {
                arrayList.add(new OnlineFieldConfig(onlCgformField));
            }
        }
        return arrayList;
    }

    /* renamed from: a */
    public static String m360a(Map<String, Object> map, String str) {
        Object m335b = m335b(map, str);
        if (m335b != null) {
            return m335b.toString();
        }
        return null;
    }

    /* renamed from: b */
    public static Object m335b(Map<String, Object> map, String str) {
        if (map == null || oConvertUtils.isEmpty(str)) {
            return null;
        }
        Object obj = map.get(str);
        if (obj != null) {
            return obj;
        }
        Object obj2 = map.get(str.toUpperCase());
        if (obj2 != null) {
            return obj2;
        }
        Object obj3 = map.get(str.toLowerCase());
        if (obj3 != null) {
            return obj3;
        }
        return null;
    }

    /* renamed from: h */
    public static List<String> m312h(String str) {
        String[] split;
        ArrayList arrayList = new ArrayList();
        if (oConvertUtils.isNotEmpty(str)) {
            for (String str2 : str.split(f233E)) {
                int indexOf = str2.indexOf("@");
                if (indexOf > 0) {
                    arrayList.add(str2.substring(0, indexOf));
                } else {
                    arrayList.add(str2);
                }
            }
        }
        return arrayList;
    }

    /* renamed from: f */
    public static Map<String, List<String>> m316f(String str, List<String> list) {
        HashMap hashMap = new HashMap(5);
        hashMap.put("id", new ArrayList());
        if (list != null) {
            for (int i = 0; i < list.size(); i++) {
                hashMap.put(list.get(i) + "_id", new ArrayList());
            }
        }
        if (oConvertUtils.isNotEmpty(str)) {
            for (String str2 : str.split(f233E)) {
                String[] split = str2.split("@");
                if (split.length > 0) {
                    ((List) hashMap.get("id")).add(split[0]);
                }
                if (split.length > 1 && list != null && list.size() > 0) {
                    for (int i2 = 1; i2 < split.length; i2++) {
                        ((List) hashMap.get(list.get(i2 - 1) + "_id")).add(split[i2]);
                    }
                }
            }
        }
        return hashMap;
    }

    /* renamed from: b */
    public static List<ExcelExportEntity> m337b(List<OnlCgformField> list, String str, String str2) {
        ArrayList arrayList = new ArrayList();
        for (int i = 0; i < list.size(); i++) {
            if ((null == str || !str.equals(list.get(i).getDbFieldName())) && list.get(i).getIsShowList().intValue() == 1) {
                ExcelExportEntity excelExportEntity = new ExcelExportEntity(list.get(i).getDbFieldTxt(), list.get(i).getDbFieldName());
                if ("image".equals(list.get(i).getFieldShowType())) {
                    excelExportEntity.setType(1);
                    excelExportEntity.setExportImageType(3);
                    excelExportEntity.setImageBasePath(str2);
                    excelExportEntity.setHeight(10.0d);
                    excelExportEntity.setWidth(60.0d);
                } else {
                    int intValue = list.get(i).getDbLength().intValue() == 0 ? 12 : list.get(i).getDbLength().intValue() > 30 ? 30 : list.get(i).getDbLength().intValue();
                    if ("date".equals(list.get(i).getFieldShowType())) {
                        excelExportEntity.setFormat("yyyy-MM-dd");
                    } else if ("datetime".equals(list.get(i).getFieldShowType())) {
                        excelExportEntity.setFormat("yyyy-MM-dd HH:mm:ss");
                    }
                    if (intValue < 10) {
                        intValue = 10;
                    }
                    excelExportEntity.setWidth(intValue);
                }
                arrayList.add(excelExportEntity);
            }
        }
        return arrayList;
    }

    /* renamed from: a */
    public static <T> List<T> m380a(Object obj, Class<T> cls) {
        ArrayList arrayList = new ArrayList();
        if (obj instanceof List) {
            for (Object obj2 : (List) obj) {
                arrayList.add(cls.cast(obj2));
            }
            return arrayList;
        }
        return null;
    }

    /* renamed from: i */
    public static boolean m311i(String str) {
        return f225w.equalsIgnoreCase(str) || f226x.equalsIgnoreCase(str) || f227y.equalsIgnoreCase(str) || f228z.equalsIgnoreCase(str) || f229A.equalsIgnoreCase(str) || "id".equalsIgnoreCase(str);
    }

    /* renamed from: j */
    public static boolean m310j(String str) {
        boolean z = false;
        Iterator it = MybatisPlusSaasConfig.TENANT_TABLE.iterator();
        while (true) {
            if (!it.hasNext()) {
                break;
            } else if (((String) it.next()).equalsIgnoreCase(str)) {
                z = true;
                break;
            }
        }
        return z;
    }

    /* renamed from: k */
    public static String m309k(String str) {
        if (str.indexOf("@") > 0) {
            str = str.substring(0, str.indexOf("@"));
        }
        return str;
    }

    /* renamed from: l */
    public static String m308l(String str) {
        String replace;
        if (oConvertUtils.isEmpty(str)) {
            return "";
        }
        String[] split = str.split("_");
        StringBuilder sb = new StringBuilder();
        for (String str2 : split) {
            if (!str2.isEmpty()) {
                sb.append(str2.charAt(0));
            }
        }
        String sb2 = sb.toString();
        if (sb2.length() >= 3) {
            replace = sb2.substring(0, 3);
        } else {
            replace = String.format("%-4s", sb2).replace(' ', 'X');
        }
        return (replace + "_" + Md5Util.md5Encode(str, "UTF-8").substring(0, 3)).toLowerCase();
    }

    /* compiled from: CgformUtil.java */
    /* renamed from: org.jeecg.modules.online.cgform.d.c$b */
    /* loaded from: hibernate-re-3.7.1-RC.jar:org/jeecg/modules/online/cgform/d/c$b.class */
    public static class C0012b implements Comparator<String> {
        @Override // java.util.Comparator
        /* renamed from: a */
        public int compare(String str, String str2) {
            if (str == null || str2 == null) {
                return -1;
            }
            if (str.compareTo(str2) > 0) {
                return 1;
            }
            if (str.compareTo(str2) < 0) {
                return -1;
            }
            if (str.compareTo(str2) == 0) {
                return 0;
            }
            return 0;
        }
    }

    /* compiled from: CgformUtil.java */
    /* renamed from: org.jeecg.modules.online.cgform.d.c$a */
    /* loaded from: hibernate-re-3.7.1-RC.jar:org/jeecg/modules/online/cgform/d/c$a.class */
    public static class C0011a implements Comparator<String> {
        @Override // java.util.Comparator
        /* renamed from: a */
        public int compare(String str, String str2) {
            if (str == null || str2 == null) {
                return -1;
            }
            if (str.length() > str2.length()) {
                return 1;
            }
            if (str.length() < str2.length()) {
                return -1;
            }
            if (str.compareTo(str2) > 0) {
                return 1;
            }
            if (str.compareTo(str2) < 0) {
                return -1;
            }
            if (str.compareTo(str2) == 0) {
                return 0;
            }
            return 0;
        }
    }
}
